package com.itheima.controller;

import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/user")//一级路径
public class UserController {
    @RequestMapping("/save")
    public String save(){
        System.out.println("UserController save is running");
        return "/page.jsp";//要跳转到根路径下的page.jsp页面
    }
    @RequestMapping("/update")
    public String update(){
        System.out.println("UserController update is running");
        return "/page.jsp";//要跳转到根路径下的page.jsp页面
    }

    @RequestMapping("/requestParam1")
    public String requestParam1(String name,Integer age){
        System.out.println(name+","+age);
        return "/page.jsp";//要跳转到根路径下的page.jsp页面
    }

    @RequestMapping("/requestParam2")
    public String requestParam2(@RequestParam("username") String name, Integer age){
        System.out.println(name+","+age);
        return "/page.jsp";//要跳转到根路径下的page.jsp页面
    }

    @RequestMapping("/requestParam3")
    public String requestParam3(User user){
        System.out.println(user);
        return "/page.jsp";//要跳转到根路径下的page.jsp页面
    }
}
